<template>
  <div class="board">
    <el-form ref="form" :model="sendInfo" label-width="80px">
      <el-form-item label="小区名称">
        <el-input v-model="sendInfo.communityname"></el-input>
      </el-form-item>
      <el-form-item label="单元名称">
        <el-input v-model="sendInfo.unitname"></el-input>
      </el-form-item>
      <el-form-item label="栋数">
        <el-input v-model="sendInfo.unitnum"></el-input>
      </el-form-item>
      <el-form-item label="状态选择">
        <el-select v-model="sendInfo.unitstatus" placeholder="请选状态">
          <el-option label="已建成" value="1"></el-option>
          <el-option label="未建成" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="资源问候">
        <el-input type="textarea" v-model="sendInfo.unitcontext"></el-input>
      </el-form-item>
    </el-form>
     <el-button  size="mini"> 取消</el-button>
    <el-button @click="shelves"  size="mini" type="primary">确定</el-button>
  </div>
</template>

<script>
import axios from "axios";
import Cookies from "js-cookie";
import Pagination from "@/components/Pagination";
export default {
  data() {
    return {
      fileList: [],
      queryInfo: [],
      srcList: [],

      tableData: [],
      sendInfo: {
        communityname:"",
        unitname: "",
        createDt: "",
        unitcontext: "",
        unitname: "",
        unitnum: "",
        unitstatus: "",
      },
      Token: "",
      componentTotal: 0,
      dialogFormVisible: false,
      onceInfo: {
       
        value: "",
        currPage: 1,
        pageNum: 10
      },
      token:
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjEyLCJ1c2VybmFtZSI6ImFkbWluIiwiZW1haWwiOiJ3ZSIsImhlYWQiOiIyMDI0MDMwODE5Mzc1Nzg3MTE4OTAuanBnIiwidHlwZSI6IjEiLCJpYXQiOjE3MTE0MzU3ODEsImV4cCI6MTcxMTUyMjE4MX0.3nVHSPwNIWRhY7qJJHplVlLKDp9iIgVEZpZ9ZPBcoYI"
    };
  },
  methods: {
    async shelves(){
       const { data: res } = await axios.post(
        `http://community.byesame.com/house/addunitList?token=${this.Token}`,
        this.sendInfo,
        {
          params: this.sendInfo
        }
      );
      this.$router.push("/message/room");
    },

  },
  mounted() {
    this.Token = Cookies.get("Admin-Token");
  },
  components: {
    Pagination
  },
  computed: {
    headers() {
      return {
        //上传图片时，携带请求头
        "X-Litemall-Admin-Token": this.Token
      };
    }
  }
};
</script>

<style lang="scss" scoped>
.board {
  padding: 20px;
}
.vatimg {
  width: 145px;
  height: 145px;
  display: block;
}
</style>